import { createRouter, createWebHashHistory } from "vue-router";
import BasicLayout from "@/components/BasicLayout/index.vue";
import i18n from "@/locales/i18n";
const { t }: any = i18n.global;
export let homeRoute = {
  path: "/home",
  name: computed(() => t("title01")),
  component: () => import("@/views/home/index.vue"),
};
export let rootRoute = {
  path: "/",
  name: "Root",
  redirect: () => {
    return { path: homeRoute.path };
  },
};
export let videoRoute = {
  path: "/video",
  name: "Video",
  component: () => import("@/views/video/index.vue"),
};
export let nationalRoute = {
  path: "/national",
  name: computed(() => t("title02")),
  component: () => import("@/views/national/index.vue"),
};
export let sportsRoute = {
  path: "/sports",
  name: computed(() => t("title03")),
  component: () => import("@/views/sports/index.vue"),
};
export let intlRoute = {
  path: "/intl",
  name: computed(() => t("title04")),
  component: () => import("@/views/intl/index.vue"),
};
export let entRoute = {
  path: "/ent",
  name: computed(() => t("title05")),
  component: () => import("@/views/ent/index.vue"),
};
export let articleDetailRoute = {
  path: "/article-detail",
  name: "ArticleDetail",
  component: () => import("@/views/ArticleDetail/index.vue"),
};
export let articleDetailRRoute = {
  path: "/article-detail-r",
  name: "ArticleDetailR",
  component: () => import("@/views/ArticleDetailR/index.vue"),
};

const routes: any[] = [
  {
    path: "/",
    name: "BasicLayout",
    component: BasicLayout,
    children: [
      rootRoute,
      homeRoute,
      videoRoute,
      nationalRoute,
      sportsRoute,
      intlRoute,
      entRoute,
      articleDetailRoute,
      articleDetailRRoute,
    ],
  },
];
const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
